package com.fz.controller;

import com.fz.entity.Book;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

/**
 * Created by webrx on 2017-09-04.
 */
@Controller
public class User {
    /*
    @RequestMapping  //http://localhost/user 类名
    public String myuser(){
        System.out.println("myuser");
        return "ok";
    }
    */

    @RequestMapping("/test") @ResponseBody
    public void ttt(){
        System.out.println("hello -------test");
    }

    public @RequestMapping("/mys") @ResponseBody String mys(){
        return "china中国人";
    }

    //@RequestMapping("/index") @ResponseBody
    //public String index(){
    //    return "index首页";
    //}

    //@RequestMapping("/test")
    //public String test(HttpServletRequest req, HttpServletResponse resp){
      //  System.out.println("test");
        //return "redirect:/test.jsp";  // /test.jsp
        //return "redirect:ok.jsp";// /ok.jsp
        //return "redirect:ok/yy";
        //resp.sendRedirect("");


        //req.getRequestDispatcher("aa").forward(req,resp);
    //}

    //@RequestMapping("/user/save") @ResponseBody
    //public String save(Book book){
    //    System.out.println(book.getName());
    //    System.out.println(book.getPrice());


        //BookDAO.save(Book book);
        //BookDao.save(book);
    //    return null;
    //}
}
